package models;

import javax.swing.table.AbstractTableModel;

public class ModelLayoutTable extends AbstractTableModel 
{
	private static final long serialVersionUID = 1L;
    private String[] columnNames =  null;
    private Object[][] data = null;
    private String synthese, frameTitle;

    public ModelLayoutTable(String synthese, String frameTitle, String[] columnNames, Object[][] data)
    {
    	this.synthese = synthese;
    	this.frameTitle = frameTitle;
    	this.columnNames = columnNames;
    	this.data = data;
    }
    
    public String getTitle()
    {
    	return frameTitle;
    }
    
    public String getSynthese()
    {
    	return synthese;
    }
    
	@Override
    public int getColumnCount()
    {
        return columnNames.length;
    }
	@Override
    public int getRowCount() 
	{
        return data.length;
    }
	@Override
    public String getColumnName(int col) 
	{
        return columnNames[col];
    }
	@Override
    public Object getValueAt(int row, int col) 
	{
        return data[row][col];
    }
	/*
    public Class<? extends Object> getColumnClass(int c) 
    {
        return getValueAt(0, c).getClass();
    }
    */
	
    // Editable ?
	@Override
    public boolean isCellEditable(int row, int col) 
    {
      return false;
    }
	@Override
    public void setValueAt(Object value, int row, int col)
    {
        data[row][col] = value;
        fireTableCellUpdated(row, col);
    }
}
